import  ansible_runner

if __name__ == '__main__':
    r = ansible_runner.run(private_data_dir='/Users/guopeilin/Developer/playbook/helloworld', playbook='site.yml')
    print('{} {}'.format(r.status, r.rc))
    for each_host_event in r.events:
        print(each_host_event['event'])
        print("Final status:")
        print(r.stats)